var Client = require("mysql-pro");
var client = new Client({
    mysql: {
        host: "127.0.0.1",
        port: 3306,
        database: "2206lvyou",
        user: "root",
        password: "root"
    }
});

function query(sql){
    return new Promise((resolve, reject) => {
        client.query(sql).then(function(result) {
            // use result
            resolve(result)
        }, function(error){
            // error
            reject(error)
        });
    })
}

module.exports = query